package com.av.android;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class SearchActivity extends BaseActivity{


	boolean flag = true;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_search);
		//		AutoCompleteTextView autoCompView = (AutoCompleteTextView) findViewById(R.id.autocomplete);
		//		autoCompView.setAdapter(new PlacesAutoCompleteAdapter(this, R.layout.list_item));
		//		autoCompView.setOnItemClickListener(this);
		String url = getIntent().getExtras().getString("url");
		final WebView webView = (WebView)findViewById(R.id.webview);
		//		webView.getSettings().setJavaScriptEnabled(true);
		//		webview.getSettings().setLoadWithOverviewMode(true);
		//		webview.getSettings().setBuiltInZoomControls(true);
//		webView.setVisibility(View.INVISIBLE);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setBuiltInZoomControls(true);
		webView.getSettings().setUseWideViewPort(true);
		webView.setInitialScale(50); 
		webView.setWebViewClient(new WebViewClient() {
			
			@Override
			public void onPageStarted(WebView view, String url,Bitmap favicon){
				
				showLoading("Loading...");
			}
			@Override
			public void onPageFinished(WebView view, String url) {
				// do your stuff here
//				if(flag ){
//					flag = false;
//					webView.loadUrl(url);
//					webView.setVisibility(View.VISIBLE);
//				}
				hideLoading();
			}
		});

		webView.loadUrl("http://titan.cmpe.boun.edu.tr:8085/cmpe451Web/Login?name="
				+LoginActivity.user.getUsername()+"&password="+LoginActivity.user.getPassword()+"&button=Login");
		webView.loadUrl(url);

		//        webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
	}


}
